﻿# CMakeList.txt: ipopt 的 CMake 项目，在此处包括源代码并定义
# 项目特定的逻辑。
#
cmake_minimum_required (VERSION 3.8)

# 如果支持，请为 MSVC 编译器启用热重载。
if (POLICY CMP0141)
  cmake_policy(SET CMP0141 NEW)
  set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()

project ("ipopt")

# 添加一些 #define 预编译
add_definitions("-DIPOPTLIB_BUILD -DHAVE_CONFIG_H")

# 将源代码添加到此项目的可执行文件。
file (GLOB Common_Source
	"src/Common/config.h"
	"src/Common/config_default.h"
	"src/Common/config.h"
	"src/Common/config_default.h"
	"src/Common/config_ipopt.h"
	"src/Common/config_ipopt default.h"
	"src/Common/configall_system.h"
	"src/Common/configall_system_msc.h"
	"src/Common/IpCachedResults.hpp"
	"src/Common/IpDebug.cpp"
	"src/Common/IpDebug.hpp"
	"src/Common/IpException.hpp"
	"src/Common/IpJournalist.cpp"
	"src/Common/IpJournalist.hpp"
	"src/Common/IpLibraryLoader.cpp"
	"src/Common/IpLibraryLoader.hpp"
	"src/Common/IpObserver.cpp"
	"src/Common/IpObserver.hpp"
	"src/Common/IpoptConfig.h"
	"src/Common/IpOptionsList.cpp"
	"src/Common/IpOptionsList.hpp"
	"src/Common/IpReferenced.hpp"
	"src/Common/IpRegOptions.cpp"
	"src/Common/IpRegOptions.hpp"
	"src/Common/IpSmartPtr.hpp"
	"src/Common/IpTaggedObject.cpp"
	"src/Common/IpTaggedObject.hpp"
	"src/Common/IpTimedTask.hpp"
	"src/Common/IpTypes.h"
	"src/Common/IpTypes.hpp"
	"src/Common/IpUtils.cpp"
	"src/Common/IpUtils.hpp"
)

file (GLOB Algorithm_Source
"src/Algorithm/IpAdaptiveMuUpdate.cpp"
"src/Algorithm/IpAlgBuilder.cpp"
"src/Algorithm/IpAlgorithmRegOp.cpp"
"src/Algorithm/IpAugRestoSystemSolver.cpp"
"src/Algorithm/IpBacktrackingLineSearch.cpp"
"src/Algorithm/IpDefaultIterateInitializer.cpp"
"src/Algorithm/IpEquilibrationScaling.cpp"
"src/Algorithm/IpExactHessianUpdater.cpp"
"src/Algorithm/IpFilter.cpp"
"src/Algorithm/IpFilterLSAcceptor.cpp"
"src/Algorithm/IpGenAugSystemSolver.cpp"
"src/Algorithm/IpGradientScaling.cpp"
"src/Algorithm/IpIpoptAlg.cpp"
"src/Algorithm/IpIpoptCalculatedQuantities.cpp"
"src/Algorithm/IpIpoptData.cpp"
"src/Algorithm/IpIteratesVector.cpp"
"src/Algorithm/IpLeastSquareMults.cpp"
"src/Algorithm/IpLimMemQuasiNewtonUpdater.cpp"
"src/Algorithm/IpLoqoMuOracle.cpp"
"src/Algorithm/IpLowRankAugSystemSolver.cpp"
"src/Algorithm/IpLowRankSSAugSystemSolver.cpp"
"src/Algorithm/IpMonotoneMuUpdate.cpp"
"src/Algorithm/IpNLPBoundsRemover.cpp"
"src/Algorithm/IpNLPScaling.cpp"
"src/Algorithm/IpOptErrorConvCheck.cpp"
"src/Algorithm/IpOrigIpoptNLP.cpp"
"src/Algorithm/IpOrigIterationOutput.cpp"
"src/Algorithm/IpPDFullSpaceSolver.cpp"
"src/Algorithm/IpPDPerturbationHandler.cpp"
"src/Algorithm/IpPDSearchDirCalc.cpp"
"src/Algorithm/IpPenaltyLSAcceptor.cpp"
"src/Algorithm/IpProbingMuOracle.cpp"
"src/Algorithm/IpQualityFunctionMuOracle.cpp"
"src/Algorithm/IpRestoConvCheck.cpp"
"src/Algorithm/IpRestoFilterConvCheck.cpp"
"src/Algorithm/IpRestoIpoptNLP.cpp"
"src/Algorithm/IpRestoIterateInitializer.cpp"
"src/Algorithm/IpRestoIterationOutput.cpp"
"src/Algorithm/IpRestoMinC_1Nrm.cpp"
"src/Algorithm/IpRestoPenaltyConvCheck.cpp"
"src/Algorithm/IpRestoRestoPhase.cpp"
"src/Algorithm/IpStdAugSystemSolver.cpp"
"src/Algorithm/IpTimingStatistics.cpp"
"src/Algorithm/IpUserScaling.cpp"
"src/Algorithm/IpWarmStartIterateInitializer.cpp"
"src/Algorithm/Inexact/IpInexactAlgBuilder.cpp"
"src/Algorithm/Inexact/IpInexactCq.cpp"
"src/Algorithm/Inexact/IpInexactData.cpp"
"src/Algorithm/Inexact/IpInexactDoglegNormal.cpp"
"src/Algorithm/Inexact/IpInexactLSAcceptor.cpp"
"src/Algorithm/Inexact/IpInexactNewtonNormal.cpp"
"src/Algorithm/Inexact/IpInexactNormalTerminationTester.cpp"
"src/Algorithm/Inexact/IpInexactPDSolver.cpp"
"src/Algorithm/Inexact/IpInexactPDTerminationTester.cpp"
"src/Algorithm/Inexact/IpInexactRegOp.cpp"
"src/Algorithm/Inexact/IpInexactSearchDirCalc.cpp"
"src/Algorithm/Inexact/IpInexactTSymScalingMethod.cpp"
"src/Algorithm/Inexact/IpIterativePardisoSolverInterface.cpp"
"src/Algorithm/Inexact/IpIterativeSolverTerminationTester.cpp"
"src/Algorithm/LinearSolvers/IpLinearSolvers.c"
"src/Algorithm/LinearSolvers/IpLinearSolversRegOp.cpp"
"src/Algorithm/LinearSolvers/IpMa27TSolverInterface.cpp"
"src/Algorithm/LinearSolvers/IpMa57TSolverInterface.cpp"
"src/Algorithm/LinearSolvers/IpMa77SolverInterface.cpp"
"src/Algorithm/LinearSolvers/IpMa86SolverInterface.cpp"
"src/Algorithm/LinearSolvers/IpMa97SolverInterface.cpp"
"src/Algorithm/LinearSolvers/IpMc19TSymScalingMethod.cpp"
"src/Algorithm/LinearSolvers/IpMumpsSolverInterface.cpp"
"src/Algorithm/LinearSolvers/IpPardisoMKLSolverInterface.cpp"
"src/Algorithm/LinearSolvers/IpPardisoSolverInterface.cpp"
"src/Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.cpp"
"src/Algorithm/LinearSolvers/IpTripletToCSRConverter.cpp"
"src/Algorithm/LinearSolvers/IpTSymDependencyDetector.cpp"
"src/Algorithm/LinearSolvers/IpTSymLinearSolver.cpp"
"src/Algorithm/IpAdaptiveMuUpdate.hpp"
"src/Algorithm/IpAlgBuilder.hpp"
"src/Algorithm/IpAlgorithmRegOp.hpp"
"src/Algorithm/IpAlgStrategy.hpp"
"src/Algorithm/IpAugRestoSystemSolver.hpp"
"src/Algorithm/IpAugSystemSolver.hpp"
"src/Algorithm/IpBacktrackingLineSearch.hpp"
"src/Algorithm/IpBacktrackingLSAcceptor.hpp"
"src/Algorithm/IpConvCheck.hpp"
"src/Algorithm/IpDefaultIterateInitializer.hpp"
"src/Algorithm/IpEqMultCalculator.hpp"
"src/Algorithm/IpEquilibrationScaling.hpp"
"src/Algorithm/IpExactHessianUpdater.hpp"
"src/Algorithm/IpFilter.hpp"
"src/Algorithm/IpFilterLSAcceptor.hpp"
"src/Algorithm/IpGenAugSystemSolver.hpp"
"src/Algorithm/IpGradientScaling.hpp"
"src/Algorithm/IpHessianUpdater.hpp"
"src/Algorithm/IpIpoptAlg.hpp"
"src/Algorithm/IpIpoptCalculatedQuantities.hpp"
"src/Algorithm/IpIpoptData.hpp"
"src/Algorithm/IpIpoptNLP.hpp"
"src/Algorithm/IpIterateInitializer.hpp"
"src/Algorithm/IpIteratesVector.hpp"
"src/Algorithm/IpIterationOutput.hpp"
"src/Algorithm/IpLeastSquareMults.hpp"
"src/Algorithm/IpLimMemQuasiNewtonUpdater.hpp"
"src/Algorithm/IpLineSearch.hpp"
"src/Algorithm/IpLoqoMuOracle.hpp"
"src/Algorithm/IpLowRankAugSystemSolver.hpp"
"src/Algorithm/IpLowRankSSAugSystemSolver.hpp"
"src/Algorithm/IpMonotoneMuUpdate.hpp"
"src/Algorithm/IpMuOracle.hpp"
"src/Algorithm/IpMuUpdate.hpp"
"src/Algorithm/IpNLPBoundsRemover.hpp"
"src/Algorithm/IpNLPScaling.hpp"
"src/Algorithm/IpOptErrorConvCheck.hpp"
"src/Algorithm/IpOrigIpoptNLP.hpp"
"src/Algorithm/IpOrigIterationOutput.hpp"
"src/Algorithm/IpPDFullSpaceSolver.hpp"
"src/Algorithm/IpPDPerturbationHandler.hpp"
"src/Algorithm/IpPDSearchDirCalc.hpp"
"src/Algorithm/IpPDSystemSolver.hpp"
"src/Algorithm/IpPenaltyLSAcceptor.hpp"
"src/Algorithm/IpProbingMuOracle.hpp"
"src/Algorithm/IpQualityFunctionMuOracle.hpp"
"src/Algorithm/IpRestoConvCheck.hpp"
"src/Algorithm/IpRestoFilterConvCheck.hpp"
"src/Algorithm/IpRestoIpoptNLP.hpp"
"src/Algorithm/IpRestoIterateInitializer.hpp"
"src/Algorithm/IpRestoIterationOutput.hpp"
"src/Algorithm/IpRestoMinC_1Nrm.hpp"
"src/Algorithm/IpRestoPenaltyConvCheck.hpp"
"src/Algorithm/IpRestoPhase.hpp"
"src/Algorithm/IpRestoRestoPhase.hpp"
"src/Algorithm/IpSearchDirCalculator.hpp"
"src/Algorithm/IpStdAugSystemSolver.hpp"
"src/Algorithm/IpTimingStatistics.hpp"
"src/Algorithm/IpUserScaling.hpp"
"src/Algorithm/IpWarmStartIterateInitializer.hpp"

"src/Algorithm/Inexact/IpInexactAlgBuilder.hpp"
"src/Algorithm/Inexact/IpInexactCq.hpp"
"src/Algorithm/Inexact/IpInexactData.hpp"
"src/Algorithm/Inexact/IpInexactDoglegNormal.hpp"
"src/Algorithm/Inexact/IpInexactLSAcceptor.hpp"
"src/Algorithm/Inexact/IpInexactNewtonNormal.hpp"
"src/Algorithm/Inexact/IpInexactNormalStepCalc.hpp"
"src/Algorithm/Inexact/IpInexactNormalTerminationTester.hpp"
"src/Algorithm/Inexact/IpInexactPDSolver.hpp"
"src/Algorithm/Inexact/IpInexactPDTerminationTester.hpp"
"src/Algorithm/Inexact/IpInexactRegOp.hpp"
"src/Algorithm/Inexact/IpInexactSearchDirCalc.hpp"
"src/Algorithm/Inexact/IpInexactTSymScalingMethod.hpp"
"src/Algorithm/Inexact/IpIterativePardisoSolverInterface.hpp"
"src/Algorithm/Inexact/IpIterativeSolverTerminationTester.hpp"

"src/Algorithm/LinearSolvers/hsl_ma77d.h"
"src/Algorithm/LinearSolvers/hsl_ma77s.h"
"src/Algorithm/LinearSolvers/hsl_ma86d.h"
"src/Algorithm/LinearSolvers/hsl_ma86s.h"
"src/Algorithm/LinearSolvers/hsl_ma97d.h"
"src/Algorithm/LinearSolvers/hsl_ma97s.h"
"src/Algorithm/LinearSolvers/hsl_mc68i.h"
"src/Algorithm/LinearSolvers/IpGenKKTSolverInterface.hpp"
"src/Algorithm/LinearSolvers/IpLinearSolvers.h"
"src/Algorithm/LinearSolvers/IpLinearSolversRegOp.hpp"
"src/Algorithm/LinearSolvers/IpMa27TSolverInterface.hpp"
"src/Algorithm/LinearSolvers/IpMa57TSolverInterface.hpp"
"src/Algorithm/LinearSolvers/IpMa77SolverInterface.hpp"
"src/Algorithm/LinearSolvers/IpMa86SolverInterface.hpp"
"src/Algorithm/LinearSolvers/IpMa97SolverInterface.hpp"
"src/Algorithm/LinearSolvers/IpMc19TSymScalingMethod.hpp"
"src/Algorithm/LinearSolvers/IpMumpsSolverInterface.hpp"
"src/Algorithm/LinearSolvers/IpPardisoMKLSolverInterface.hpp"
"src/Algorithm/LinearSolvers/IpPardisoSolverInterface.hpp"
"src/Algorithm/LinearSolvers/IpSlackBasedTSymScalingMethod.hpp"
"src/Algorithm/LinearSolvers/IpSparseSymLinearSolverInterface.hpp"
"src/Algorithm/LinearSolvers/IpSymLinearSolver.hpp"
"src/Algorithm/LinearSolvers/IpTDependencyDetector.hpp"
"src/Algorithm/LinearSolvers/IpTripletToCSRConverter.hpp"
"src/Algorithm/LinearSolvers/IpTSymDependencyDetector.hpp"
"src/Algorithm/LinearSolvers/IpTSymLinearSolver.hpp"
"src/Algorithm/LinearSolvers/IpTSymScalingMethod.hpp"
)


file (GLOB Interfaces_Source
"src/Interfaces/IpInterfacesRegOp.cpp"
"src/Interfaces/IpIpoptApplication.cpp"
"src/Interfaces/IpSolveStatistics.cpp"
"src/Interfaces/IpStdCInterface.cpp"
"src/Interfaces/IpStdFInterface.c"
"src/Interfaces/IpStdInterfaceTNLP.cpp"
"src/Interfaces/IpTNLP.cpp"
"src/Interfaces/IpTNLPAdapter.cpp"
"src/Interfaces/IpTNLPReducer.cpp"
"src/Interfaces/IpAlgTypes.hpp"
"src/Interfaces/IpInterfacesRegOp.hpp"
"src/Interfaces/IpIpoptApplication.hpp"
"src/Interfaces/IpNLP.hpp"
"src/Interfaces/IpReturnCodes.h"
"src/Interfaces/IpReturnCodes.hpp"
"src/Interfaces/IpReturnCodes_inc.h"
"src/Interfaces/IpSolveStatistics.hpp"
"src/Interfaces/IpStdCInterface.h"
"src/Interfaces/IpStdInterfaceTNLP.hpp"
"src/Interfaces/IpTNLP.hpp"
"src/Interfaces/IpTNLPAdapter.hpp"
"src/Interfaces/IpTNLPReducer.hpp"
"src/Interfaces/Ipopt.java"
"src/Interfaces/IpReturnCodes.inc"
)

file (GLOB LinAlg_Source
"src/LinAlg/TMatrices/IpGenTMatrix.cpp"
"src/LinAlg/TMatrices/IpSymTMatrix.cpp"
"src/LinAlg/TMatrices/IpTripletHelper.cpp"
"src/LinAlg/IpBlas.cpp"
"src/LinAlg/IpCompoundMatrix.cpp"
"src/LinAlg/IpCompoundSymMatrix.cpp"
"src/LinAlg/IpCompoundVector.cpp"
"src/LinAlg/IpDenseGenMatrix.cpp"
"src/LinAlg/IpDenseSymMatrix.cpp"
"src/LinAlg/IpDenseVector.cpp"
"src/LinAlg/IpDiagMatrix.cpp"
"src/LinAlg/IpExpandedMultiVectorMatrix.cpp"
"src/LinAlg/IpExpansionMatrix.cpp"
"src/LinAlg/IpIdentityMatrix.cpp"
"src/LinAlg/IpLapack.cpp"
"src/LinAlg/IpLowRankUpdateSymMatrix.cpp"
"src/LinAlg/IpMatrix.cpp"
"src/LinAlg/IpMultiVectorMatrix.cpp"
"src/LinAlg/IpScaledMatrix.cpp"
"src/LinAlg/IpSumMatrix.cpp"
"src/LinAlg/IpSumSymMatrix.cpp"
"src/LinAlg/IpSymScaledMatrix.cpp"
"src/LinAlg/IpTransposeMatrix.cpp"
"src/LinAlg/IpVector.cpp"
"src/LinAlg/IpZeroMatrix.cpp"
"src/LinAlg/IpZeroSymMatrix.cpp"
"src/LinAlg/TMatrices/IpGenTMatrix.hpp"
"src/LinAlg/TMatrices/IpSymTMatrix.hpp"
"src/LinAlg/TMatrices/IpTripletHelper.hpp"
"src/LinAlg/IpBlas.hpp"
"src/LinAlg/IpCompoundMatrix.hpp"
"src/LinAlg/IpCompoundSymMatrix.hpp"
"src/LinAlg/IpCompoundVector.hpp"
"src/LinAlg/IpDenseGenMatrix.hpp"
"src/LinAlg/IpDenseSymMatrix.hpp"
"src/LinAlg/IpDenseVector.hpp"
"src/LinAlg/IpDiagMatrix.hpp"
"src/LinAlg/IpExpandedMultiVectorMatrix.hpp"
"src/LinAlg/IpExpansionMatrix.hpp"
"src/LinAlg/IpIdentityMatrix.hpp"
"src/LinAlg/IpLapack.hpp"
"src/LinAlg/IpLowRankUpdateSymMatrix.hpp"
"src/LinAlg/IpMatrix.hpp"
"src/LinAlg/IpMultiVectorMatrix.hpp"
"src/LinAlg/IpScaledMatrix.hpp"
"src/LinAlg/IpSumMatrix.hpp"
"src/LinAlg/IpSumSymMatrix.hpp"
"src/LinAlg/IpSymMatrix.hpp"
"src/LinAlg/IpSymScaledMatrix.hpp"
"src/LinAlg/IpTransposeMatrix.hpp"
"src/LinAlg/IpVector.hpp"
"src/LinAlg/IpZeroMatrix.hpp"
"src/LinAlg/IpZeroSymMatrix.hpp"
)

file (GLOB contrib_Source
"src/contrib/CGPenalty/IpCGPenaltyCq.cpp"
"src/contrib/CGPenalty/IpCGPenaltyData.cpp"
"src/contrib/CGPenalty/IpCGPenaltyLSAcceptor.cpp"
"src/contrib/CGPenalty/IpCGPenaltyRegOp.cpp"
"src/contrib/CGPenalty/IpCGPerturbationHandler.cpp"
"src/contrib/CGPenalty/IpCGSearchDirCalc.cpp"
"src/contrib/CGPenalty/IpPiecewisePenalty.cpp"
"src/contrib/CGPenalty/IpCGPenaltyCq.hpp"
"src/contrib/CGPenalty/IpCGPenaltyData.hpp"
"src/contrib/CGPenalty/IpCGPenaltyLSAcceptor.hpp"
"src/contrib/CGPenalty/IpCGPenaltyRegOp.hpp"
"src/contrib/CGPenalty/IpCGPerturbationHandler.hpp"
"src/contrib/CGPenalty/IpCGSearchDirCalc.hpp"
"src/contrib/CGPenalty/IpPiecewisePenalty.hpp"
)

file (GLOB Cpp_example_Source
"examples/Cpp_example/cpp_example.cpp"
"examples/Cpp_example/MyNLP.cpp"
"examples/Cpp_example/MyNLP.hpp"
)

# 添加头文件附件目录
include_directories(
	${CMAKE_CURRENT_SOURCE_DIR}/src/Algorithm/LinearSolvers
	${CMAKE_CURRENT_SOURCE_DIR}/src/LinAlg/TMatrices
	${CMAKE_CURRENT_SOURCE_DIR}/src/LinAlg
	${CMAKE_CURRENT_SOURCE_DIR}/src/contrib/CGPenalty
	${CMAKE_CURRENT_SOURCE_DIR}/src/Common
	${CMAKE_CURRENT_SOURCE_DIR}/src/Interfaces
	${CMAKE_CURRENT_SOURCE_DIR}/src/Algorithm
	${CMAKE_CURRENT_SOURCE_DIR}/deps/linux/include/coin-or/mumps
)
message("111 ${CMAKE_CURRENT_SOURCE_DIR}/deps/linux/include/coin-or/mumps") 
# 添加依赖库路径
link_directories(
	"${CMAKE_CURRENT_SOURCE_DIR}/deps/linux/lib"
	"/data/opt/intel/oneapi/mkl/2023.1.0/lib/intel64"
	"/data/opt/intel/oneapi/advisor/2023.1.0/include/pkgconfig/lib64"
	"/data/opt/intel/oneapi/ccl/2021.9.0/lib/pkgconfig"
	"/data/opt/intel/oneapi/compiler/2023.1.0/lib/pkgconfig"
	"/data/opt/intel/oneapi/dal/2023.1.0/lib/pkgconfig"
	"/data/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/../lib/pkgconfig"
	"/data/opt/intel/oneapi/dpl/2022.1.0/lib/pkgconfig"
	"/data/opt/intel/oneapi/inspector/2023.1.0/include/pkgconfig/lib64"
	"/data/opt/intel/oneapi/ippcp/2021.7.0/lib/pkgconfig"
	"/data/opt/intel/oneapi/mkl/2023.1.0/lib/pkgconfig"
	"/data/opt/intel/oneapi/mpi/2021.9.0/lib/pkgconfig"
	"/data/opt/intel/oneapi/tbb/2021.9.0/env/../lib/pkgconfig"
	"/data/opt/intel/oneapi/vtune/2023.1.0/include/pkgconfig/lib64"
	"/home/wqlee/IpoptBuild/build_lib/lib"
)

add_executable (ipopt ${Common_Source} ${Algorithm_Source} ${Interfaces_Source} ${LinAlg_Source} ${contrib_Source} ${Cpp_example_Source}) 

# 添加依赖库
target_link_libraries(ipopt coinmumps coinasl dl mkl_intel_lp64 mkl_sequential mkl_core m stdc++)



if (CMAKE_VERSION VERSION_GREATER 3.12)
  set_property(TARGET ipopt PROPERTY CXX_STANDARD 20)
endif()

# TODO: 如有需要，请添加测试并安装目标。
